//
//  main.cpp
//  PEI
//
//  Created by asc on 10/03/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <signal.h>
#include <unistd.h>
#include "Vista.h"
#include "Modelo/Modelo_Tablero.h"
#include "Vista-std/VistaPantalla.h"
#include <sys/poll.h>
#include <unistd.h>
#include <ncurses.h>
#include <curses.h>

using namespace std;

int main(int argc, const char * argv[])
{
    Modelo* table = new tablero(16,7,true);
    Vista* pantalla = new VistaPantalla(*table);
    
    
    struct pollfd fds;
    int ret;
    fds.fd = STDIN_FILENO; /* this is STDIN */
    fds.events = POLLIN;
    
    int i=0;
    //while (true) {
    while (i!=10) {
        //system("clear");
        ((tablero*)table)->calculaSiguienteEtapa();
        ret = poll(&fds, 1, 0);
        if(ret == 1){
            string algo;
            getline(cin, algo);
            cout << algo << endl;
        }
        else {
            cout << "no hay nada en la entrada" << endl;
        }
        sleep(1);
        i++;
    }    
    delete table;
    delete pantalla;
    // insert code here...
    cout << "Hello, World!\n" ;
    return 0;
}
